﻿using System;
using System.Collections.Generic;
using System.Web.Mvc.Async;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xwang.Task.Bll;
using Xwang.Task.Model;

namespace Xwang.Task.MvcApp.Tests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            TaskInfoService taskInfoService = new TaskInfoService();
            var task = new TaskInfo()
            {
                TaskTitle = "测试" +DateTime.Now.ToLongTimeString(),
                TaskDesc = "任务测试",
                TaskBeginTime = DateTime.Now,
                TaskStatus = 0,
                TaskProperty = 0,
                TaskEndTime = Convert.ToDateTime("2015-05-28"),
               // TaskRealEndTime = Convert.ToDateTime("2015-05-28"),
                Biller = 2,
                BillDate = DateTime.Now
                
            };
            task.TaskJoinUser.Add(new TaskJoinUser() { UserId = 2 });
            taskInfoService.Add(task);
            taskInfoService.Savechanges();
            Assert.IsTrue(task.KeyId > 0);
        }

        [TestMethod]
        public void TestGetTaskCountByGroup()
        {
            var service = new TaskJoinUserService();
            var c = 0;
            var vals = service.GetTaskCountByGroup(2);
            foreach (var count in vals )
            {
                c += count;
                Console.WriteLine(count);
            }
          
        }
    }
}
